package com.xlhj.elastic.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

/**
 * @author: liucaijing
 * @description: 用户信息实体类
 * @date: 2021/5/11 14:23
 */
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
//@Document(indexName = "userInfo", shards = 3, replicas = 1)
public class SysUser {

    /**
     * 主键ID
     */
    @Id
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户名
     */
    @Field(type = FieldType.Text, analyzer = "ik max word")
    private String userName;

    /**
     * 密码
     */
    @Field(type = FieldType.Keyword, index = false)
    private String password;

    /**
     * 真实名称
     */
    private String realName;

    /**
     * 性别0:男;1:女;2:其他
     */
    private Integer sex;

    /**
     * 手机号
     */
    @Field(type = FieldType.Keyword)
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 删除标识0:未删除;1:已删除
     */
    @TableLogic
    private Integer delFlag;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
